package com.iweb.user.controller;

import com.iweb.user.service.UserRefundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
@CrossOrigin
public class RefundController {

    @Autowired
    private UserRefundService userRefundService;

    @PostMapping("/refunds")
    public String refundOrder(@RequestParam long orderId) {
        return userRefundService.processRefund(orderId);
    }
}